package com.boke.order.sharding;

import com.google.common.collect.Range;
import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingValue;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/* ━━━━━━佛祖保佑━━━━━━
 *                  ,;,,;
 *                ,;;'(    社
 *      __      ,;;' ' \   会
 *   /'  '\'~~'~' \ /'\.)  主
 * ,;(      )    /  |.     义
 *,;' \    /-.,,(   ) \    码
 *     ) /       ) / )|    农
 *     ||        ||  \)
 *     (_\       (_\
 * ━━━━━━永无BUG━━━━━━
 * @author ：zjq
 * @date ：2020/7/30 16:31  https://shardingsphere.apache.org/document/legacy/4.x/document/cn/features/sharding/concept/sharding/
 * @description: TODO  复合分片： 配合复合策略使用，支持范围与精确查询
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 */
public class OrderComplexShardingAlgorithm implements ComplexKeysShardingAlgorithm {
    @Override
    public Collection<String> doSharding(Collection collection, ComplexKeysShardingValue shardingValue) {

        //Collection有多少张表
        //collection:真实的节点oms_order_0,oms_order_1

        collection.stream().forEach((item) -> {
            System.out.println("item:)" + item);
        });

        List<String> list = new ArrayList<>();
        /**
         * 范围查询
         */
        Range range = (Range) shardingValue.getColumnNameAndRangeValuesMap().get("id");


        return null;
    }
}
